#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    mpGraphicsDropShadowEffect= new ZGraphicsDropShadowEffect(this);
    mpGraphicsDropShadowEffect->setColor(QColor(100,100,100,100));
    mpGraphicsDropShadowEffect->setBlurRadius(2);
    mpGraphicsDropShadowEffect->setOffset(2.5);

    ui->label->setGraphicsEffect(mpGraphicsDropShadowEffect);
    ui->pushButton->setGraphicsEffect(mpGraphicsDropShadowEffect);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_Color_clicked()
{
    QColorDialog colorDialog;
    colorDialog.exec();
    qDebug()<<colorDialog.currentColor();
    mpGraphicsDropShadowEffect->setColor(colorDialog.currentColor());
}

void MainWindow::on_verticalSlider_Blu_valueChanged(int value)
{
    double blurRadius = value/10.0;
    mpGraphicsDropShadowEffect->setBlurRadius(blurRadius);
}


void MainWindow::on_horizontalSlider_X_valueChanged(int value)
{
    double Xoffset = value/10.0;
    mpGraphicsDropShadowEffect->setXOffset(Xoffset);
}


void MainWindow::on_verticalSlider_Y_valueChanged(int value)
{
    double Yoffset = value/10.0;
    mpGraphicsDropShadowEffect->setYOffset(Yoffset);
}


void MainWindow::on_checkBox_clicked(bool checked)
{
    qDebug()<<mpGraphicsDropShadowEffect->boundingRect();
    mpGraphicsDropShadowEffect->setEnabled(checked);
}

